#include "app_runner.h"
#include "app_device.h"
#include <stdbool.h>
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
static  bool is_running=true;


  void  signal_handler(int sig)
  {
      is_running=false;
  }

/**
 * @brief 启动主应用程序
 */
void app_runner_start(void)
{

    //注册信号的处理
    signal(SIGINT,signal_handler );//ctrl+c
    signal(SIGTERM, signal_handler); //kill

     printf("初始化程序...\n");
     app_device_init(MODBUS_DEV_FILE_NAME);

     printf("启动程序...\n");
     app_device_start();

     while(is_running)
     {
         sleep(1);
     }

     printf("退出程序...\n");
     app_device_destroy();


}